package com.onec.service.unsafe;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
import sun.misc.Unsafe;

import java.lang.reflect.Field;

public class GetUnSafe {

    // 反射获取
    public static Unsafe getUnSafe() throws NoSuchFieldException, IllegalAccessException {
        Field theUnSafe = Unsafe.class.getDeclaredField("theUnsafe");
        theUnSafe.setAccessible(true);
        return (Unsafe) theUnSafe.get(null);

      //ConcurrentHashMap
    }


}
